<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    const arr = ['1', '2', '3']
        //数组解构变量
    let [a, b, c] = arr
    console.log(a, b, c);
    //数组解构给对象
    const obj = {
        name: "张",
        age: "111",
        hahh: function() {
            console.log('哈哈哈哈');
        }
    }
    let {
        name,
        age,
        hahh
    } = obj;
    console.log(name, age, hahh);
    hahh()

    const str = ["1", "2", "3"]
        //数组解构变量
    let [a, b, c] = str;
    console.log(a, b, c);
    //数组解构对象
    const obj1 = {
        name: "阿亮",
        age: "121",
        hhh: function() {
            console.log("哈哈哈哈哈哈");
        }
    }
    let {
        name,
        age,
        hhh
    } = obj1;
    console.log(name, age, hhh);
    hhh()

    const str = ["1", "2", "3"]
        //数组解构变量
    let [a, b, c] = str;
    console.log(a, b, c);
    //数组解构对象
    const cg = {
        name: "阿亮",
        age: "31",
        fn: function() {
            console.log("其为气温气温");
        }
    }
    let {
        name,
        age,
        fn
    } = cg;
    console.log(name, age, fn);
    fn();
</script>

</html>